import React, {Component} from 'react';

export default class one extends Component {
    constructor(props) {
        super(props);
        this.state = {};
    }

    componentDidMount() {
        const spa = document.getElementsByClassName('newss')
        for (let i = 0; i < spa.length; i++) {
          console.log( '展示房屋标签', spa[i].innerText)
            if (spa[i].innerText === '在售') {
                spa[i].className = 'show'
            } else if (spa[i].innerText === '新盘') {
                spa[i].className = 'new_house'
            }
        }

    }

    render() {
        let data = this.props.data;
        console.log(23, data)
        return (
            <a href={this.props.href + '/' + this.props.id}>
                <div className='my_card'>
                    <div className='my_card_left'>
                        <img src={data.img} style={{width: '100%', height: '100%'}} alt=""/>
                    </div>
                    <div className='my_card_right'>
                        <div className='my_card_right_top'>
                            <ul>
                                <li>
                                    <ul>
                                        <li><p>{data.name}</p><p className='newss'>{data.state}</p></li>
                                        <li><p className={'oness'}>{data.site}</p><p>{data.hose_type}</p></li>
                                    </ul>
                                </li>
                                <li>{data.price}元/m²</li>
                            </ul>
                        </div>
                        <div className='my_card_right_but'>
                            <ul>
                                {data.new_arr.map((txt) => <li>{txt}</li>)}
                            </ul>
                        </div>

                    </div>
                </div>
            </a>
        )
    }
}
